//
//  NSString+hexCodec.m
//  HandPaySwiperModule
//
//  Created by marco on 14/12/12.
//  Copyright (c) 2014年 marco. All rights reserved.
//

#import "NSString+hexCodec.h"
#import "GTMStringEncoding.h"

@implementation NSString (hexCodec)

-(NSData*)decodeToHexString
{
    NSString* target = self;
    if (target.length % 2 == 1)
        target = [NSString stringWithFormat:@"0%@",self];
    return [[GTMStringEncoding hexStringEncoding] decode:target];
}

-(NSString*)leftPaddingWithChart:(NSString*)oneChartString resultStringLength:(NSUInteger)count
{
    NSMutableString* result = [[NSMutableString alloc] init];
    for (int i = 0; i < count - self.length; i++)
        [result appendString:oneChartString];
    [result appendString:self];
    return result;
}

@end
